package com.example.yyjc.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName InterceptorConfig
 * @Description TODO       将所有路径放出，无拦截必要
 * @Author lvyongwei
 * @Date 2020-11-30 13:49
 **/
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //添加拦截路径
        List<String> list=new ArrayList<>();
        /*list.add("/country/**");
        list.add("/industry/**");*/
        List<String> list2=new ArrayList<>();
        list2.add("/user/registerPhone");
        list2.add("/user/register");
        list2.add("/user/login");
        list2.add("/user/forgetPasswordSendMsg");
        list2.add("/user/updatePassword");
        list2.add("/user/touristLogin");
        list2.add("/user/getAllUser");
        list2.add("/user/importAllUser");
        list2.add("/country/**");
        list2.add("/industry/**");
        list2.add("/selection/**");
        list2.add("/report/**");
        list2.add("/select/**");
        list2.add("/import/**");
        list2.add("/exchange/**");
        registry.addInterceptor(new MyHandlerInterceptor())
                //指定黑名单，只要匹配到路径就运行拦截器的方法
                .addPathPatterns(list)
                //指定白名单，直接绕过拦截器
                .excludePathPatterns(list2);
    }
}